/*
** my_power_it.c for my_power_it in /home/goupil_r//afs/local/Jour_05
** 
** Made by robin goupil
** Login   <goupil_r@epitech.net>
** 
** Started on  Fri Oct  5 10:00:08 2012 robin goupil
** Last update Fri Oct  5 15:07:29 2012 robin goupil
*/

int	my_power_it(int nb, int power)
{
  int	nb_still;
  int	verif;

  nb_still = nb;
  if (power == 0)
    return (1);
  else if (nb < 0)
    return (0);
  while (nb > 1 && power > 1)
    {
      verif = nb_still * nb;
      if (verif % nb_still != 1)
	return (0);
      nb = verif;
      power = power - 1;
    }
  return (nb);
}
